Skip to content

[Feat] 코스 절반 지점 도달 시 정상 인증 푸시 추가#110

Merged
JangInho merged 2 commits into
developfrom
feat/#89-summit-push
May 25, 2026
Merged

[Feat] 코스 절반 지점 도달 시 정상 인증 푸시 추가#110
JangInho merged 2 commits into
developfrom
feat/#89-summit-push

Conversation

@JangInho

@JangInho JangInho commented May 25, 2026

Copy link
Copy Markdown
Contributor

🧾 요약

  • 코스 절반 지점 도달 시 정상 인증 푸시 추가

🔗 이슈

✨ 변경 내용

  • 코스 절반 지점 도달 시 정상 인증 푸시 추가

✅ 확인

  • 빌드 OK
  • 테스트 OK

Summary by CodeRabbit

  • New Features

    • Summit milestone detection: users receive an in-app alert when they pass the halfway point of a course.
    • Push notifications prompt users to confirm arrival at the summit checkpoint.
    • Notifications are delivered idempotently so each session triggers the summit notice only once.
  • Database

    • Notification type constraints updated to include the new summit notification.

Review Change Stack

@JangInho JangInho self-assigned this May 25, 2026
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b89fa1cf-2683-46bd-914f-da1232532d54

📥 Commits

Reviewing files that changed from the base of the PR and between 505e04e and 58b56e0.

📒 Files selected for processing (1)
  • src/main/java/com/semosan/api/domain/tracking/service/TrackingMilestoneTriggerService.java

📝 Walkthrough

Walkthrough

Adds TRACKING_SUMMIT_REACHED, sends a WebSocket and FCM when a session reaches 50% of a course, enforces Redis Set idempotency for single delivery, and routes milestone evaluation through TrackingMilestoneTriggerService.

Changes

Summit Notification at 50% Course Distance

Layer / File(s) Summary
Summit Notification Type Definition
src/main/java/com/semosan/api/domain/notification/enums/NotificationType.java
New TRACKING_SUMMIT_REACHED enum constant with Korean body template "정상에 도착했나요? 정상 인증하기!" and no required parameters.
Summit Evaluation & Milestone Detection Logic
src/main/java/com/semosan/api/domain/tracking/service/TrackingMilestoneTriggerService.java
Adds class docs for summit flow, defines COURSE_MILESTONE_COUNT = 4, routes evaluate(...) to evaluateSummit(...) in course mode, computes halfway mark, uses Redis Set tracking:session:{sessionId}:summit:notified for idempotency (SADD + TTL), publishes a WebSocket payload to /topic/tracking/{sessionId}/summit, and dispatches TRACKING_SUMMIT_REACHED FCM (errors logged).
Service Dependency Wiring & Database Schema
src/main/java/com/semosan/api/domain/tracking/service/TrackingSessionService.java, src/main/java/com/semosan/api/domain/tracking/service/TrackingStreamConsumer.java, src/main/resources/db/migration/V17__update_notifications_type_check.sql
TrackingSessionService and TrackingStreamConsumer now inject/use TrackingMilestoneTriggerService instead of the photo trigger; session creation and GPS-point handling call the milestone trigger. DB migration updates notifications_type_check to include TRACKING_SUMMIT_REACHED.

Sequence Diagram

sequenceDiagram
  participant Consumer as TrackingStreamConsumer
  participant Service as TrackingMilestoneTriggerService
  participant Redis as Redis Set
  participant WebSocket as WebSocket Topic
  participant FCM as FCM Notification
  
  Consumer->>Service: evaluate(sessionId, userId, distanceTotal)
  Service->>Service: detectCourseMode(milestones.size == 4)
  alt Course Mode Detected
    Service->>Service: computeCourseDistance(lastMilestone)
    Service->>Service: evaluateSummit(distanceTotal, courseDistance)
    Service->>Service: computeHalfwayMark(courseDistance)
    Service->>Redis: SADD tracking:session:{id}:summit:notified
    alt First Notification
      Redis-->>Service: 1 (newly added)
      Service->>WebSocket: publish(summit, halfwayMark, timestamp)
      Service->>FCM: send(TRACKING_SUMMIT_REACHED)
      FCM-->>Service: success or logged failure
    else Already Notified
      Redis-->>Service: 0 (exists)
      Service->>Service: return early
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • SEMOSAN/SEMOSAN_BE#55: Related work modifying tracking-notification enums and DB CHECK constraint for tracking notifications.
  • SEMOSAN/SEMOSAN_BE#79: Related changes to switching milestone evaluation from photo trigger to milestone trigger and adding tracking notification types.

Suggested labels

enhancement

Poem

🐰 Halfway up the trail I hop and sing,
Redis keeps count so only one bell rings,
WebSocket hums, and FCM gives a cheer,
"You've reached the summit—prove it here!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: 코스 절반 지점 도달 시 정상 인증 푸시 추가' directly describes the main change: adding summit authentication push notifications when users reach the halfway point of a course during tracking.
Linked Issues check ✅ Passed The PR fully implements the core requirement from issue #89: detecting when tracking reaches 50% of course distance and sending a push notification with the new TRACKING_SUMMIT_REACHED notification type.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the summit halfway-point push notification feature. The modifications include the new notification enum, milestone trigger logic, service wiring, and database migration—all necessary and scoped to the feature.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#89-summit-push

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/main/java/com/semosan/api/domain/tracking/service/TrackingMilestoneTriggerService.java`:
- Around line 146-148: The current code calls redisTemplate.expire(key, TTL)
unconditionally, causing unnecessary Redis writes after the summit marker is
already present; change the logic in TrackingMilestoneTriggerService so that you
only call redisTemplate.expire(key, TTL) when the SADD actually inserted the
member (i.e., when Long added returned from redisTemplate.opsForSet().add(key,
"1") is non-null and > 0). Concretely, move the expire call into the branch that
checks added (or guard it with if (added != null && added > 0L) {
redisTemplate.expire(key, TTL); }) and leave the existing handling for added ==
null || added == 0L unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a966b61-0d9e-430e-aa8d-92dae6f7f6ce

📥 Commits

Reviewing files that changed from the base of the PR and between 3725e17 and 505e04e.

📒 Files selected for processing (5)
  • src/main/java/com/semosan/api/domain/notification/enums/NotificationType.java
  • src/main/java/com/semosan/api/domain/tracking/service/TrackingMilestoneTriggerService.java
  • src/main/java/com/semosan/api/domain/tracking/service/TrackingSessionService.java
  • src/main/java/com/semosan/api/domain/tracking/service/TrackingStreamConsumer.java
  • src/main/resources/db/migration/V17__update_notifications_type_check.sql

50% 통과 후 매 GPS 점마다 EXPIRE 가 호출되던 핫패스 부하 제거.
SADD 가 새로 추가된 경우(added=1) 에만 TTL 을 세팅하도록 가드 위치 이동.
@JangInho
JangInho merged commit a147199 into develop May 25, 2026
1 check was pending
@pooreumjung pooreumjung changed the title feat: 코스 절반 지점 도달 시 정상 인증 푸시 추가 [Feat]코스 절반 지점 도달 시 정상 인증 푸시 추가 May 25, 2026
@pooreumjung pooreumjung changed the title [Feat]코스 절반 지점 도달 시 정상 인증 푸시 추가 [Feat] 코스 절반 지점 도달 시 정상 인증 푸시 추가 May 25, 2026
@howooyeon
howooyeon deleted the feat/#89-summit-push branch May 29, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 코스 절반 도달 시 푸시 보내기

1 participant